/*
 * @Author: WangLong
 * @Date: 2022-11-08 13:25:07
 * @LastEditTime: 2022-11-14 11:10:10
 * @LastEditors: WangLong
 * @Description:
 * @FilePath: \jnks-drone-company\src\utils\rsa.js
 */
import JSEncrypt from "jsencrypt";
const pubKey = `MIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEAhomGLaRvHUChVEjmS5145Hp+EW84sT5l
xHM8JP7KFqvqUBp0VknW+lQATFGXrWPxwI9US0oN4mziL3w7a7hM2srKpx1TaOlwsyQT1r4ma/6C
JtHc4GoFtn5TTACbecJ3D0mSuYjTXLwnH1nmKNuZi0g5gE4cYRGHEaStmjROzulGjArJcv7gjUYP
YOBk/HLzLxAHj3887LMZTBMCTgzccH5AqJ8sE5+99zA24yhxbNqE57y/5qC5yji7aWMz1ZJQ8zem
lrmP3dgbOa/tTEh8NF69Q4uwqUC1O0oyPkdiO4WQHITWqzoBwAoMlb48CPaqADezBaoel1FVlolo
J7+xmwIDAQAB`;

export function setRsa(pubStr) {
  const sign = new JSEncrypt();
  const date = +new Date();
  const key = pubStr + "@@" + date;
  sign.setPublicKey(pubKey);
  return sign.encrypt(key);
}
